package com.hsav.kcxb.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.hsav.kcxb.R;
import com.hsav.kcxb.adapter.BaseAdapterManager;
import com.hsav.kcxb.adapter.PriceManager;
import com.hsav.kcxb.adapter.RecyclerBaseAdapter;
import com.hsav.kcxb.bean.PriceBean;

import java.util.ArrayList;
import java.util.List;

public class FortouneActivity extends Activity {

    private RecyclerView mPriceRecyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fortoune);
        initView();
    }

    private void initView() {
        mPriceRecyclerView = (RecyclerView) findViewById(R.id.recycler_price_list);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(FortouneActivity.this, 3, GridLayoutManager.VERTICAL, false);
        ArrayList<PriceBean> priceBeenList = new ArrayList<>();
        for (int i = 0; i < 9; i++) {
            PriceBean priceBean = new PriceBean();
            priceBean.setAmount(i*100);
            priceBeenList.add(priceBean);
        }
        PriceManager priceManager = new PriceManager(R.layout.item_price_view, priceBeenList,this);
        RecyclerBaseAdapter<PriceBean> recyclerBaseAdapter = new RecyclerBaseAdapter<>(FortouneActivity.this, priceManager);
        mPriceRecyclerView.setLayoutManager(gridLayoutManager);
        mPriceRecyclerView.setAdapter(recyclerBaseAdapter);
    }
}
